home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / tcsel003.zip / COPYINC.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-16  |  3KB  |  103 lines

  1. { COPYINC.PAS    Author: Trevor J Carlsen
  2.                          PO Box 568
  3.                          Port Hedland  6721
  4.                          Western Australia
  5.  
  6.  
  7. SYNTAX:    copyinc filename
  8.  
  9. where filename is the name of a text file you wish to create that will be used
  10. as an include file in a Turbo Pascal program.
  11.  
  12. This program creates a text file in the format
  13.  
  14.       const
  15.         RegStr  ='This program is an unregistered copy';
  16.         CodeStr =
  17.         #125#34#139#139#74#71#94#61#44#78#65#155#158#132#62#136#141#140#84+
  18.         #34#155#63#38#46#89#84#93#57#153#51#83#112#72#36#138#93;
  19.         keyval  = 1234567890;
  20.  
  21. The text file that was used by COPYINC to create the above include file would
  22. have looked like this
  23.  
  24. p:\prog\freeload.inc
  25. This program is an unregistered copy
  26. RegStr  =
  27. CodeStr =
  28. 1234567890
  29.  
  30. Here is another example.  This was the include file -
  31.  
  32.       const
  33.         ChkStr     : string ='This program is registered to';
  34.         CodeChkStr : string =
  35.         #32#153#90#34#133#140#42#129#150#50#81#36#83#36#133#154#52#76#75+
  36.         #129#45#93#77#44#83#149#157#71#95#225;
  37.         keyval  = 1234567890;
  38.  
  39. and the text file used by COPYINC -
  40.  
  41. p:\prog\registed.inc
  42. This program is registered to 
  43. ChkStr     : string =
  44. CodeChkStr : string =
  45. 1234567890
  46.  
  47.  
  48. The text file must always consist of five lines that are
  49.  1.  The name of the include file to be created.
  50.  2.  The plain text.
  51.  3.  The name of the plain text constant along with its syntax.
  52.  4.  The name and syntax of the coded text constant.
  53.  5.  A key value.  Any number in the longint range is valid.
  54.  
  55.  
  56. }
  57.  
  58. uses
  59.   endecode;  { my encryption unit }
  60.  
  61. const
  62.   hash   = '#';
  63. var
  64.   f      : text;
  65.   params : text;
  66.   keyval : longint;
  67.   notice,
  68.   fname,
  69.   CodeStr,
  70.   CodeVar,
  71.   PlainVar: string;
  72.   x      : word;
  73.  
  74. begin
  75.   assign(params,ParamStr(1));
  76.   reset(params);
  77.   readln(params,fname);
  78.   readln(params,notice);
  79.   readln(params,PlainVar);
  80.   readln(params,CodeVar);
  81.   readln(params,keyval);
  82.   CodeStr := EncryptStr(keyval,notice);
  83.   notice := '  '+ PlainVar + #39 + notice + #39#59;
  84.   assign(f,fname);
  85.   rewrite(f);
  86.   writeln(f,'const');
  87.   writeln(f,notice);
  88.   writeln(f,'  ',CodeVar);
  89.   write(f,'  ');
  90.   for x := 1 to length(CodeStr) do begin
  91.     if x mod 20 = 0 then begin
  92.       writeln(f,'+');
  93.       write(f,'  ');
  94.     end;
  95.     write(f,'#',ord(CodeStr[x]));
  96.   end;
  97.   writeln(f,';');
  98.   writeln(f,'  keyval  = ',keyval,#59);
  99.   writeln(f);
  100.   close(f);
  101. end.
  102.  
  103.